package org.sundatagroup.aurora.core.service.message;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import com.google.gson.JsonElement;

/**
 * <p>异步消息处理类
 * </p>
 * 
 * @author Zdream
 * @date 2018-05-30
 * @since 0.2.0
 */
@Component
public class MessageExecuter {
	
    private final static Logger LOGGER = LoggerFactory.getLogger(MessageExecuter.class);
	
	/**
	 * 异步消息部分
	 * @param reciever
	 * @param msg
	 * @param data
	 */
	@Async
	public void doRecieve(IMessageReciever reciever, String msg, JsonElement data) {
		LOGGER.debug("接收异步消息: " + msg);
		try {
			reciever.recieve(msg, data);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
